package com.example.springboot_system.Controller;

import com.example.springboot_system.pojo.Patient;
import com.example.springboot_system.pojo.vo.register.*;
import com.example.springboot_system.service.RegisterService;
import com.example.springboot_system.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/register")
public class ssController {

    @Autowired
    private RegisterService registerService;

    /**
     * 新办理就诊卡
     * @param patient
     * @return
     */
    @RequestMapping("/addPatientInfor")
    @ResponseBody
    public ResponseResult addPatientInfor(@RequestBody Patient patient) {
        return registerService.addPatientInfor(patient);
    }

    /**
     * 补办就诊卡
     * @param patient
     * @return
     */
    @RequestMapping("/coverCardId")
    @ResponseBody
    public ResponseResult coverCardId(@RequestBody Patient patient) {
        return registerService.updatePatientInfor(patient);
    }

    /**
     * 读取就诊卡
     * @return
     */
    @RequestMapping("/getCardIdInfor")
    @ResponseBody
    public ResponseResult getCardIdInfor(@RequestBody GetCardIdInforReqVO reqVO) throws Exception {
        return registerService.getCardIdInfor(reqVO);
    }


    /**
     * 获取医生
     *
     * @param reqVO
     * @return
     */

    @RequestMapping(value = "/getAllRegisterDoctor")
    @ResponseBody
    public List<RegisterDoctorRspVO> getAllRegisterDoctor(RegisterTypeReqVO reqVO) {
        return registerService.getAllRegisterDoctor(reqVO);
    }


    /**
     * 挂号记录查询
     *
     * @param reqVO
     * @return
     */
    @RequestMapping(value = "/getRegisterRecord")
    @ResponseBody
    public List<RegisterRecordRspVO> getRegisterRecord(RegisterRecordSearchReqVO reqVO) {
        return registerService.getRegisterRecord(reqVO);
    }


    /**
     * 提交挂号信息
     * @param reqVO
     * @return
     */

    @RequestMapping(value = "/addRegisterInfor")
    @ResponseBody
    public ResponseResult addRegisterInfor(@RequestBody RegisterInforReqVO reqVO, HttpSession session) {
        return registerService.addRegisterInfor(reqVO, session);
    }

}
